# -*- coding: UTF-8 -*-
import socket,time

SIZE = 1024

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 建立连接:
s.connect(('127.0.0.1', 9999))
# 接收欢迎消息:

# s.send('hello server')
s.send('fuck server')
print s.recv(SIZE)
time.sleep(0.5)
print 'command test begins ...'
s.send('c')
s.send('weeding')
print 'command test ended'
time.sleep(0.5)

print 'image test begins ...'
s.send('f')
time.sleep(0.2)
with open('01.jpg', 'rb') as f:
    for data in f:
        s.send(data)
print 'image test ended'

s.close()
print 'connection closed'